﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Catalog.aspx.cs" Inherits="home_Catalog" %>
<%@ Register TagPrefix="PM" TagName="LeftMenu" Src="~/control/LeftMenu.ascx" %>
<%@ Register TagPrefix="PM" TagName="Header" Src="~/control/Header.ascx" %>
<%@ Register TagPrefix="PM" TagName="Footer" Src="~/control/Footer.ascx" %>
<%@ Register TagPrefix="PM" TagName="Pager" Src="~/control/Pager.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Works management</title>
    <link rel="Stylesheet" type="text/css" href="../css/style.css" media="all" />
    <link rel="Stylesheet" type="text/css" href="../css/window.css" media="all" />
    <link rel="Stylesheet" type="text/css" href="../css/button.css" media="all" />
    
    <script type="text/javascript" language="javascript" src="../js/jquery-1.4.1.js"></script>
    <script type="text/javascript" language="javascript" src="../js/commonfunctions.js"></script>
    <script type="text/javascript" language="javascript" src="../js/catalog.js"></script>
    <script type="text/javascript" language="javascript" src="../js/dragwindow.js"></script>
    <script type="text/javascript" language="javascript">
        setDrag("#window_catalog");
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <PM:Header ID="header" runat="server" />
        <div class="clear"></div>
        <table>
            <tr>
                <td style="vertical-align:top;">
                    <PM:LeftMenu ID="left_menu" runat="server" />
                </td>
                <td style="vertical-align:top;">
                    <div id="main">
                        <asp:Panel runat="server" ID="menu">
                            <a href="#" id="add" runat="server">
                                <img alt="" src="../images/Add.png" />
                                <span>Thêm mới</span>
                            </a>
                            <asp:HyperLink runat="server" ID="viewAll" NavigateUrl="#">
                                <img alt="" src="../images/View.png" />
                                <span>Xem tất cả công việc</span>
                            </asp:HyperLink>
                            <!--<asp:LinkButton runat="server" ID="edit">
                                <img alt="" src="../images/Edit.png" />
                                <span>Sửa</span>
                            </asp:LinkButton>
                            <asp:LinkButton runat="server" ID="delete">
                                <img alt="" src="../images/Delete.png" />
                                <span>Xóa</span>
                            </asp:LinkButton>
                            -->
                        </asp:Panel>
                        <div style="float:right;">
                            <span runat="server" id="label1">Sắp xếp theo</span>
                            <asp:DropDownList runat="server" ID="orderby" 
                              AutoPostBack="true" onselectedindexchanged="orderby_SelectedIndexChanged"   
                                >
                                <asp:ListItem Selected="True" Text="Tên dự án" Value="projectname"></asp:ListItem>
                                <asp:ListItem Text="Tên chuyên mục" Value="name"></asp:ListItem>
                                <asp:ListItem Text="Mức ưu tiên" Value="priority"></asp:ListItem>
                                <asp:ListItem Text="Phần trăm hoàn thành" Value="completepercent"></asp:ListItem>
                            </asp:DropDownList>
                            <span runat="server" id="label2">Theo thứ tự</span>
                            <asp:DropDownList runat="server" ID="order" 
                              AutoPostBack="true" onselectedindexchanged="order_SelectedIndexChanged"  
                                >
                                <asp:ListItem Selected="True" Text="Giảm dần" Value="DESC"></asp:ListItem>
                                <asp:ListItem Text="Tăng dần" Value="ASC"></asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div class="clear"></div>
                        <asp:GridView runat="server" ID="catalogs" AutoGenerateColumns="false"
                          PageSize="10" DataKeyNames="id" Width="100%" CellPadding="5" 
                          onrowcommand="catalogs_RowCommand"
                           
                          >
                         <Columns>
                            <asp:BoundField DataField="id" Visible="false" />
                            <asp:BoundField HeaderText="STT" DataField="order" />
                            <asp:TemplateField ItemStyle-CssClass="name" HeaderText="Chuyên mục">
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" Text='<%#Eval("name")%>' runat="server"
                                     NavigateUrl='<%#"~/home/Work.aspx?catalog="+Eval("id")%>' 
                                    >
                                    </asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Miêu tả" DataField="description" />
                            <asp:BoundField HeaderText="Dự án" DataField="projectname" />
                            <asp:TemplateField HeaderText="Ưu tiên/ Hoàn thành" ItemStyle-Width="60">
                                <ItemTemplate>
                                    <div >
                                        <%# DisplayEnum.DisplayPriority(Int32.Parse(Eval("priority").ToString()))%>
                                        <br />
                                        <span class="percentborder" title='<%# Eval("completepercent").ToString()%> phần trăm '></span>
                                        <span class="percent" title='<%# Eval("completepercent").ToString()%>'></span>
                                        <br />
                                        <%# Eval("completepercent").ToString()+"%"%>
                                    </div>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Người tạo" DataField="userName"/>
                            <asp:TemplateField HeaderText="Chức năng" ItemStyle-Width="60">
                                <ItemTemplate>
                                    <a href="#" id="editCatalog" onclick="return editCatalog('<%#Eval("id")%>');">
                                        <img alt="" src="../images/Edit.png" />
                                    </a>
                                    <asp:LinkButton PostBackUrl="" runat="server" CommandName="removeCatalog" CommandArgument='<%#Eval("id")%>' ID="removeCatalog" OnClientClick="return confirm('Xóa chuyên mục này ?');" >
                                        <img alt="" src="../images/Delete.png" />
                                    </asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                         </Columns>
                        </asp:GridView>
                        <asp:Label runat="server" ID="display"></asp:Label>
                        <PM:Pager runat="server" ID="pager" />
                    </div>
                </td>
            </tr>
        </table>
        <div class="clear"></div>
        <PM:Footer runat="server" ID="footer" />
        
        <!-- pop up window -->
        <div class="transparent_window" >
        </div>
        <div class="content_window" id="window_catalog">
            <div class="header">
                <span id="window_title">Thêm chuyên mục</span>
                <a href="#" class="close">&nbsp;</a>
            </div>
            <div class="main">
                <table cellpadding="2px" cellspacing="0" width="85%">
                    <tr>
                        <td class="title">Tên chuyên mục</td>
                        <td>
                            <input id="name_catalog" type="text" class="txt" />
                        </td>
                    </tr>
                    <tr>
                        <td class="title">Miêu tả</td>
                        <td>
                            <textarea id="des_catalog" cols="30" rows="5" style="margin:0;">
                            </textarea>
                        </td>
                    </tr>
                     <tr>
                        <td class="title">
                            Dự án
                        </td>
                        <td> 
                            <asp:DropDownList runat="server" ID="project_catalog">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Mức độ ưu tiên
                        </td>
                        <td> 
                            <asp:DropDownList runat="server" ID="priority_catalog">
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="footer">
                <asp:LinkButton ID="btOk" runat="server" Text="OK" CssClass="ok" OnClientClick="return addCatalog();"
                  OnClick="btOk_Click">
                </asp:LinkButton>
                <a href="#" class="cancel">Cancel</a>
            </div>
        </div>
    </form>
</body>
</html>
